import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import 'package:kunlun_gas/app_files.dart';

import 'action.dart';
import 'state.dart';

Widget buildView(
    UserInfoEditViewState state, Dispatch dispatch, ViewService viewService) {
  return Scaffold(
    appBar: myAppBar(viewService.context, title: '修改联系方式'),
    backgroundColor: Colors.white,
    body: MyInkWellWidget(
      child: Container(
        width: ScreenUtil.screenWidthDp,
        padding: EdgeInsets.only(left: 15, right: 15, bottom: 8),
        decoration: BoxDecoration(
            color: Colors.white,
            border: Border(
                bottom: BorderSide(color: ThemeConfig.separeColor, width: 10))),
        child: Column(
          children: [
            Container(
              height: 44,
              child: Align(
                alignment: Alignment.centerLeft,
                child: Row(
                  children: [
                    Text(
                      '客户姓名',
                      style: TextThemeConfig.Font14WithColor66,
                    ),
                    Padding(padding: EdgeInsets.only(left: 50)),
                    Text(
                      state.userInfo.userName,
                      style: TextThemeConfig.Font14WithColor22,
                    ),
                  ],
                ),
              ),
              margin: EdgeInsets.only(bottom: 4),
              decoration: BoxDecoration(
                  border: Border(
                      bottom: BorderSide(color: ThemeConfig.separeColor))),
            ),
            Container(
              height: 44,
              decoration: BoxDecoration(
                  border: Border(
                      bottom: BorderSide(color: ThemeConfig.separeColor))),
              child: Row(
                children: [
                  Text(
                    '联系方式',
                    style: TextThemeConfig.Font14WithColor66,
                  ),
                  Padding(padding: EdgeInsets.only(left: 50)),
                  Expanded(
                    child: TextField(
                      minLines: 1,
                      autofocus: true,
                      keyboardType: TextInputType.phone,
                      controller: state.phoneController,
                      style: TextThemeConfig.Font14WithColor22,
                      decoration: InputDecoration(
                        border: InputBorder.none,
                        hintText: "请输入联系方式",
                        hintStyle: TextThemeConfig.Font14WithColor99,
                        contentPadding: EdgeInsets.only(bottom: 11),
                      ),
                    ),
                  ),
                ],
              ),
            ),
            Container(
              margin: EdgeInsets.only(top: 100, left: 15, right: 15, bottom: 30),
              decoration: BoxDecoration(
                borderRadius: BorderRadius.all(Radius.circular(4)),
                color: ThemeConfig.mainColor,
              ),
              height: 50,
              width: double.infinity,
              child: MyInkWellWidget(
                child: Center(
                  child: Padding(
                    padding: EdgeInsets.only(bottom: 1),
                    child: Text(
                      '保存',
                      style: TextThemeConfig.Font16WithWhite,
                    ),
                  ),
                ),
                onTap: () => dispatch(UserInfoEditViewActionCreator.onSubmit()),
              ),
            ),
          ],
        ),
      ),
      onTap: () => CommonUtils.closeKey(viewService.context),
    ),
  );
}
